
const hg = [{
  itemStyle: {
    piccolor: require("../images/map/hggreen.png"),
    x: 0,
    y: 17,
    fontcolor: "#519fff"
  },
  name: "霞山海关",
  namenew: '霞山',
  symbolSize: 6,
  value: [110.419006, 21.190221]
},
{
  itemStyle: {
    piccolor: require("../images/map/hggreen.png"),
    x: -72,
    y: 3,
    fontcolor: "#519fff"
  },
  name: "湛江机场海关",
  namenew: "机场",
  symbolSize: 6,
  value: [109.975422, 21.278047]
},
{
  itemStyle: {
    piccolor: require("../images/map/hggreen.png"),
    x: 15,
    y: 3,
    fontcolor: "#519fff"
  },
  name: "东海岛海关",
  namenew: "东海",
  symbolSize: 6,
  value: [110.599092, 20.903761]
},
{
  itemStyle: {
    piccolor: require("../images/map/hggreen.png"),
    x: 15,
    y: 3,
    fontcolor: "#519fff"
  },
  name: "徐闻海关",
  namenew: "徐闻",
  symbolSize: 6,
  value: [110.193555, 20.321851]
},
{
  itemStyle: {
    piccolor: require("../images/map/hggreen.png"),
    x: -50,
    y: 3,
    fontcolor: "#519fff"
  },
  name: "霞海海关",
  namenew: "霞海",
  symbolSize: 6,
  value: [110.08565, 21.454696]
},
{
  itemStyle: {
    piccolor: require("../images/map/hggreen.png"),
    x: 15,
    y: 3,
    fontcolor: "#519fff"
  },
  name: "廉江海关",
  namenew: "廉江",
  symbolSize: 6,
  value: [110.281449, 21.576994]
},
{
  itemStyle: {
    piccolor: require("../images/map/hggreen.png"),
    x: 15,
    y: 3,
    fontcolor: "#519fff"
  },
  name: "海东新区海关",
  namenew: "海东",
  symbolSize: 6,
  value: [110.5, 21.46]
},
{
  itemStyle: {
    piccolor: require("../images/map/hggreen.png"),
    x: 15,
    y: 3,
    fontcolor: "#519fff"
  },
  name: "茂名海关",
  namenew: "茂名",
  symbolSize: 6,
  value: [110.923925, 21.657667]
},
{
  itemStyle: {
    piccolor: require("../images/map/hgred.png"),
    x: 15,
    y: 3,
    fontcolor: "#ff0000"
  },
  name: "湛江海关",
  namenew: "",
  symbolSize: 6,
  value: [110.399042, 21.239151, 2]
}
]
export const option = {
  tooltip: {
    show: true,
    trigger: 'item',
    triggerOn: 'mousemove',
    // formatter: "名称:{b}"
  },
  // 配置显示系列
  series: [{
    name: "海关分布",
    type: 'custom', //配置显示方式为用户自定义
    // map: 'zjmm',
    coordinateSystem: 'geo',
    itemStyle: {
      normal: {
        color: '#46bee9'
      }
    },
    // zoom: 1,

    renderItem: function (params, api) { //具体实现自定义图标的方法
      const mapSign = hg[params.dataIndex].itemStyle.piccolor;
      return {
        type: 'group', //以组的形式
        children: [
          // 图片
          {
            type: 'image',
            style: {
              image: mapSign,
              // 坐标xy，可以在后面加值调整位置
              x: api.coord([
                hg[params.dataIndex].value[0], hg[params.dataIndex]
                  .value[1]
              ])[0],
              y: api.coord([
                hg[params.dataIndex].value[0], hg[params.dataIndex]
                  .value[1]
              ])[1],
              width: 15,
              height: 15
            }
          },
          // 文字
          {
            type: 'text',
            style: {
              // 文字
              text: hg[params.dataIndex].name,
              x: api.coord([
                hg[params.dataIndex].value[0], hg[params.dataIndex]
                  .value[1]
              ])[0] + hg[params.dataIndex].itemStyle.x,
              y: api.coord([
                hg[params.dataIndex].value[0], hg[params.dataIndex]
                  .value[1]
              ])[1] + hg[params.dataIndex].itemStyle.y,
              // 字体颜色
              fill: hg[params.dataIndex].itemStyle.fontcolor
            }
          }
        ]
      }
    },
    data: hg
  }],
  geo: {
    //要填刚刚注册的地图名称
    map: 'zjmm',
    label: {
      emphasis: {
        show: true
      }
    },
    //是否开启鼠标缩放和平移漫游
    roam: false,
    //当前视角的缩放比例
    zoom: 1.2,
    //地图每个区域的样式。
    itemStyle: {
      normal: {
        //区域颜色
        areaColor: '#073D9D',
        //区域边界颜色
        borderColor: '#389BEF',
        //区域边界线粗细
        borderWidth: 1,
        // color:'rgba(0,24,110,0.6)',
        //区域阴影颜色
        shadowColor: '#135CBE',
        //区域阴影大小
        shadowBlur: 4,
        //区域阴影x轴偏移
        shadowOffsetX: 4
      },
      emphasis: {
        //鼠标停留区域的高亮颜色
        areaColor: '#b3f3f3'
      }
    }
  }
};
